<?php
namespace App\Admin\Controllers;
use App\Http\Controllers\Controller;
use App\Model\UserProfile;
use Encore\Admin\Controllers\ModelForm;
use Encore\Admin\Grid;
use Encore\Admin\Form;
use Encore\Admin\Layout\Content;
use App\Model\UserLoginLog;

class  UserLoginLogController extends Controller
{
    use ModelForm;

    public function index()
    {
        $content = new Content();
        $content->header('日志记录');
        $content->body($this->grid());
        return $content;
    }

    protected function grid()
    {
        $grid = new Grid(new UserLoginLog());
        $grid->model();
        $grid->user_id('用户ID')->sortable();
        $grid->userProfile()->nick_name('用户昵称');
        $grid->client_ip('IP');
        $grid->remote_port('端口');
        //禁用导出
        $grid->disableExport();
        //禁用行选择
        $grid->disableRowSelector();
        //禁用新增
        $grid->disableCreation();

        $grid->actions(function (Grid\Displayers\Actions $actions) {
            $actions->disableDelete();
            $actions->disableView();
        });
        return $grid;
    }

}
